package com.egdigital.allzic;

import android.app.Application;
import android.content.Context;

import com.egdigital.allzic.adswizz.AdsWizzManager;
import com.google.android.gms.analytics.GoogleAnalytics;
import com.google.android.gms.analytics.Tracker;

public class ApplicationGlobal extends Application {

	private static Context			mContext;
	private Tracker					mTracker;
	private static AdsWizzManager	mAdswizzManager;

	public ApplicationGlobal() {
		super();
	}

	@Override
	public void onCreate() {
		mContext = this;
		mAdswizzManager = AdsWizzManager.getInstance(mContext);
		super.onCreate();
	}

	/**
	 * The application context
	 * 
	 * @return mContext
	 */
	public static Context getContext() {
		return mContext;
	}

	/**
	 * A Singleton of the tracker
	 * 
	 * @return instance of the mTracker
	 */
	public synchronized Tracker getTracker() {
		if (mTracker == null) {
			mTracker = GoogleAnalytics.getInstance(this).newTracker(R.xml.analytics_config);
		}
		return mTracker;
	}

	/**
	 * The class that manage Adswizz
	 * 
	 * @return instance of adswizzClickIntent
	 */
	public static AdsWizzManager getAdsWizzManager() {
		return mAdswizzManager;
	}
}
